package com.weijianhuawen.wjblog.web.convert;

import com.weijianhuawen.wjblog.common.domain.dos.WikiDo;
import com.weijianhuawen.wjblog.web.mode.vo.wiki.FindWikiPageListRspVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @version: java version 8
 * @Author: weijianhuawen
 * @description:
 * @date: 2024-12-05 22:31
 */
@Mapper
public interface WikiConvert {
    // 初始化convert实例
    WikiConvert INSTANCE = Mappers.getMapper(WikiConvert.class);

    // 将do转换为vo
    @Mappings({
            @Mapping(target = "isTop", expression = "java(bean.getWeight() > 0)")
    })
    FindWikiPageListRspVo wikiDo2FindWikiPageListRspVo(WikiDo bean);
}
